<template>
  <el-select size="small" v-model="form[item.key]" filterable :disabled="disabled">
    <el-option v-for="opt in options" :key="opt.userId" :label="opt.cname" :value="opt.userId">
    </el-option>
  </el-select>
</template>

<script lang="ts">
import { defineComponent, ref, PropType } from 'vue'
import { ObjectType } from 'typings/interfaces'
import { fetchGetAllUser } from '@/api/user'

export default defineComponent({
  components: {},
  props: {
    disabled: {
      type: Boolean,
      required: true,
    },
    item: {
      type: Object,
      required: true,
    },
    form: {
      type: Object as PropType<ObjectType>,
      required: true,
    },
  },
  setup() {
    const options = ref<ObjectType[]>([])
    fetchGetAllUser().then((d) => {
      options.value = d.data.data
    })
    return {
      options,
    }
  },
})
</script>

<style scoped lang="scss">
</style>
